//Field.h Header file
//Zach Agudelo, Andi Cescolini, Sam Tarin

//Field is the main class for the program that runs the its main functions:
//OnLoop to cycle thorugh gameplay, OnRender to update, and onInit/onCleanup
//to open/close
   
    #ifndef FIELD_H
    #define FIELD_H
       
       
    //#include "SDL/SDL.h"
    #include "FieldSurface.h"
    #include "FieldEvent.h"
    
   #include "FieldAnimation.h"
    #include "FieldEntity.h"
     
    //inherits from field event to allow all events to be redefined in field as needed
    class Field : public FieldEvent {
   
     
        public:
            Field();   //constuctor
            int OnExecute();    //Function called in main
            bool OnInit();                  //initialize
            void OnEvent(SDL_Event* Event); //events like mouse and buttons
            void OnLButtonDown(int, int);   //
            void OnKeyDown(SDLKey, SDLMod, Uint16); //key pressed
            void OnKeyUp(SDLKey, SDLMod, Uint16); //key unpressed
            void OnExit();                                              //close with X in top corner
            void OnLoop();                                              //main game loop actions
            void OnRender();                                            //drawing here
            void OnCleanup();                                   //free all memory  
            void OnTackle();                                            //handle tackles
            void moveBall(float,float, int); //move player i specified x and y dist
            void handOff();                                             //give other player at position the ball
            void checkCatch();                                  //see if the ball lands where a player is
            void changeControl(int);                    //other player has ball
            void OnIncomplete();                                //resets to last down position
            void onTouchdown();                                 //allow for display of touchdown
                        void afterTD();                                                 //reset the players beginning position
            void hike();                                                        //ball animates from line to qb
            void onLoser();                   //display animation for loser
   
         private:
            bool            Running;            //is the game still going?
            SDL_Surface*    Surf_Display;       //the screen
            SDL_Surface*    Surf_Field;         //used for displaying the field
            SDL_Surface*    Surf_Player;        //used for displaying the players
            SDL_Surface*    Surf_Ball;          //displays ball
            SDL_Surface*    Surf_TD;                    
            float currentmx;                    //position of mouseclick
            float currentmy;
            int up;                                                             //player direction 1 means moving that way 0 means stationary
            int down;
            int left;
            int right;
            int handoffkey;                                             //enter is pressed
            int click;                                                          //mouse is clicked
            float slope;                                                        //for throwing(draws line between points)
            float fracSlope;
            float xdifference;
            float ydifference;
                                float angle;    
            int downNumber;                                             //1st,2nd...
            int live;                                                           //play is live                                          
            int who;                                                                    //player i with ball
            int canPass;                                                        //hasn't passed line or caught ball
            int tdgo;                                                           //display touchdown
                int hikeball;                                                   //spacebar pressed to start play
                int losergo;                                                    //display loser
            
            
            
       
            FieldEntity         footballFieldEntity; //object for field
            
            FieldEntity         transitionEntity; //object for changing control
            FieldEntity        newballEntity;  //makes an entity for the actual ball 
           //objects for offense
            FieldEntity         qbEntity;     //used to be "ballEntity", I changed all of the ones that are not commented out to qbEntity so I could make a new ballEntity that is actually the ball 
            FieldEntity         player1Entity;  
            FieldEntity         player2Entity;    
            FieldEntity         player3Entity;   
            FieldEntity         player4Entity; 
            FieldEntity        player9Entity;
            FieldEntity        player10Entity;
            FieldEntity        player14Entity;
           //objects for defense
            FieldEntity         player5Entity;  
            FieldEntity         player6Entity;    
            FieldEntity         player7Entity;   
            FieldEntity         player8Entity; 
                        FieldEntity        player11Entity;
                        FieldEntity        player12Entity;
                        FieldEntity        player13Entity;
            FieldEntity                    player15Entity;
            FieldEntity        touchdown;
            FieldEntity        loser;
    };
     
    #endif


